function delay(time) {
  const last = Date.now();
  while (Date.now() - last < time) {}
  console.log("页面已加载1s");
}

delay(1000);
